<!--
 * @Description: Text.prototype Comment.prototype
 * @Author: zzj
 * @Date: 2021-09-14 10:18:23
 * @LastEditors: zzj
 * @LastEditTime: 2021-09-14 10:28:47
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Text.prototype Comment.prototype</title>
</head>
<body>
    <script>
        var text = document.createTextNode("hello");
        console.log(text.length);  //返回字符长度
        text.appendData(" zzj");  //追加文本  没有返回值
        console.log(text);
        text.deleteData(0,6);  //删除文本 （开始位置，长度）
        console.log(text);
        text.replaceData(0,3,"xiaohong");  //替换文本
        console.log(text);
        var res =  text.splitText(4);   //从beginIndex位置将当前文本节点分成两个文本节点
        console.log(res);  //hong
        console.log(text);  //xiao
        console.log(text.substringData(0,2));//xi  从beginIndex开始提取count个子字符串 (beginIndex,count)

    </script>
</body>
</html>